package com.example.web.filter;


import lombok.extern.slf4j.Slf4j;

import javax.servlet.*;
import java.io.IOException;

/**
 * <p>
 *
 * </p>
 *
 * @author 12071
 * @date 2022/7/29 15:37
 */
@Slf4j
public class MyFilter implements Filter {
    @Override
    public void init(FilterConfig filterConfig) throws ServletException {
        log.info("++++++++++ init in MyFilter: {}", filterConfig.getFilterName());
    }

    @Override
    public void doFilter(ServletRequest servletRequest, ServletResponse servletResponse, FilterChain filterChain) throws IOException, ServletException {
        log.info("++++++++++ doFilter in MyFilter");
        log.info("++++++++++ before chain.doFilter");
        filterChain.doFilter(servletRequest, servletResponse);
        log.info("++++++++++ after chain.doFilter");
    }

    @Override
    public void destroy() {
        log.info("++++++++++ destroy in MyFilter");
    }
}
